import service from '@/utils/crmRequest'

export default () => ({

  // 终端---创建
  TERMINAL_CREATE: (data,id = 0) => {
    return service({
      url: '/api/terminal/create?id=' + id,
      method: 'post',
      data
    })
  },

  // 终端---创建
  TERMINAL_TREE: () => {
    return service({
      url: 'api/sysSalesArea/tree',
      method: 'GET',
    })
  },

  // 终端---编辑
  TERMINAL_EDIT: (data) => {
    return service({
      url: '/api/terminal/edit',
      method: 'PUT',
      data
    })
  },

  // 终端---列表
  TERMINAL_LIST: (data) => {
    return service({
      url: '/api/terminal/list',
      method: 'post',
      data
    })
  },

  TERMINAL_LIST_PRODUCT: (data) => {
    return service({
      url: '/api/product/getListByLine',
      method: 'post',
      data
    })
  },

  // 终端---删除
  TERMINAL_DELETE: (id) => {
    return service({
      url: `/api/terminal/deleteById?id=${id}`,
      method: 'DELETE',
    })
  },

  // 终端--终端直销
  TERMINAL_DIRECT: (data) => {
    return service({
      url: `/api/terminal/direct/list`,
      method: 'post',
      data
    })
  },

  // 终端--终端直销--产品
  TERMINAL_DIRECT_PEODUCT: (params) => {
    return service({
      url: `/api/dev/product-for-register`,
      method: 'post',
      params
    })
  },

  // 终端--终端直销--产品效验终端
  TERMINAL_DIRECT_PEODUCT_ID: (data) => {
    return service({
      url: `/api/terminal/direct/checkTerminal`,
      method: 'post',
      data
    })
  },

  // 终端---详情
  TERMINAL_DETAIL: (id) => {
    return service({
      url: `/api/terminal/detail?id=${id}`,
      method: 'get',
    })
  },

  // 终端---判断终端名称是否重复
  TERMINAL_NAME: (params) => {
    return service({
      url: `/api/terminal/valid/name`,
      method: 'get',
      params
    })
  },

  // 联系人
  HEAD_PEOPLE: (status) => {
    return service({
      url: `/api/sysUser/downList?status=${status}`,
      method: 'get',
    })
  },

  // 部门
  DEPARTMENT_LIST: () => {
    return service({
      url: `/api/sysDept/tree`,
      method: 'get',
    })
  },

  //* *********************注册终端************************************************
  // 注册终端---注册终端获取产品列表
  REGISTERED_TERMINAL_PRODUCT: (params) => {
    return service({
      url: `/api/product/getListByTerminalId`,
      method: 'get',
      params
    })
  },

  // 注册终端---渠道列表
  REGISTERED_TERMINAL_CHANNEL: (params) => {
    return service({
      // url: `/api/agent/opened-account/all/list`,
      url: `/api/agent/list`,
      method: 'get',
      params
    })
  },

  // 注册终端---模糊匹配含对应招商计划列表
  REGISTERED_TERMINAL_PLAN: (data) => {
    return service({
      url: `/api/dev/list-for-search-plan`,
      method: 'post',
      data
    })
  },

  // 注册终端---提交
  REGISTERED_TERMINAL_SUBMIT: (data) => {
    return service({
      url: `/api/dev/agent-set-terminal`,
      method: 'post',
      data
    })
  },

  // 注册终端---变更信息
  REGISTERED_TERMINAL_DIRECT_CHANGE: (data) => {
    return service({
      url: `/api/dev/direct/change`,
      method: 'post',
      data
    })
  },

  // 注册终端---交易价
  REGISTERED_TERMINAL_AGENT: (data) => {
    return service({
      url: `/api/agentProduct/list-by-terminal`,
      method: 'post',
      data
    })
  },

  // 注册终端---删除
  REGISTERED_DELETE: (id) => {
    return service({
      url: `/api/terminal/del/dev-info?id=${id}`,
      method: 'delete',
    })
  },

  // 注册终端---终端价
  REGISTERED_TERMINAL_LIST: (data) => {
    return service({
      url: '/api/productPriceStrategy/getListByTerminalInfo',
      method: 'post',
      data
    })
  },

  TERMINAL_FAILURE: (id) => {
    return service({
      url: `/api/dev/fail/operation?id=${id}`,
      method: 'get',
    })
  },

  //* ********************开发中产品************************************************
  PRODUCT_LIST: (data) => {
    return service({
      url: '/api/dev/list-for-search-developing-product',
      method: 'post',
      data
    })
  },

  // 开发中产品---设置配送商
  PRODUCT_DISTRIBUTE: (data) => {
    return service({
      url: '/api/terminal/do/distribute',
      method: 'post',
      data
    })
  },

  //* *********************营销合同************************************************
  // 合同---新建
  SALES_CREATE: (data) => {
    return service({
      url: `/api/contract/create`,
      method: 'post',
      data
    })
  },

  // 合同---更新
  SALES_UPDATE: (data) => {
    return service({
      url: `/api/contract/update`,
      method: 'put',
      data
    })
  },

  // 合同---终端列表
  SALES_LIST: (data) => {
    return service({
      url: `/api/contract/list`,
      method: 'post',
      data
    })
  },

  // 合同---删除
  SALES_DELETE: (id) => {
    return service({
      url: `/api/contract/delete?id=${id}`,
      method: 'DELETE',
    })
  },

  // 合同---详情
  SALES_DDETAIL: (id) => {
    return service({
      url: `/api/contract/detail?id=${id}`,
      method: 'GET',
    })
  },

  // 合同---终止
  SALES_END: (id) => {
    return service({
      url: `/api/contract/end?id=${id}`,
      method: 'put',
    })
  },

  // 合同---根据合同对象选相对方名称
  CONTRACT_NAME: (params) => {
    return service({
      url: `/api/contract/module-list`,
      method: 'get',
      donNotShowLoading: true,
      params
    })
  },

  //* ********************客户地址*************************************************
  // 客户地址---创建
  CUSTOMER_CREATE: (data) => {
    return service({
      url: `/api/customer-address/create`,
      method: 'post',
      data
    })
  },

  // 客户地址---编辑
  CUSTOMER_UPDATE: (data) => {
    return service({
      url: `/api/customer-address/update`,
      method: 'put',
      data
    })
  },

  // 客户地址---列表
  CUSTOMER_LIST: (data) => {
    return service({
      url: `/api/customer-address/getList`,
      method: 'post',
      data
    })
  },

  // 客户地址---删除
  CUSTOMER_DELETE: (id) => {
    return service({
      url: `/api/customer-address/delete?id=${id}`,
      method: 'DELETE',
    })
  },

  // 客户地址---设置默认地址
  CUSTOMER_DEFAULT: (id) => {
    return service({
      url: `/api/customer-address/do/default?id=${id}`,
      method: 'GET',
    })
  },

  //* **********************联系人*********************************
  // 联系人---创建
  CONTACT_CREATE: (data) => {
    return service({
      url: `/api/agentLinkman/create`,
      method: 'post',
      data
    })
  },

  // 联系人---编辑
  CONTACT_UPDATE: (data) => {
    return service({
      url: `/api/agentLinkman/edit`,
      method: 'put',
      data
    })
  },

  // 联系人---列表
  CONTACT_LIST: (data) => {
    return service({
      url: `/api/agentLinkman/getList`,
      method: 'post',
      data
    })
  },

  // 联系人---删除
  CONTACT_DELETE: (id) => {
    return service({
      url: `/api/agentLinkman/deleteById?id=${id}`,
      method: 'DELETE',
    })
  },

  //* ***********************开发中产品*****************************
  // 开发中产品---配送商
  PRODUCT_PULLLIST: (name) => {
    return service({
      url: `/api/distribute/getPullList?distributeName=${name}`,
      method: 'get',
    })
  },

  // 开发中产品---配送费
  PRODUCT_GETPULLLIST: (data) => {
    return service({
      url: `/api/distributeContractDetail/getPullList`,
      method: 'post',
      data
    })
  },

  // 开发中产品---详情
  PRODUCT_DETAILS: (id) => {
    return service({
      url: `/api/dev/detail?id=${id}`,
      method: 'get',
    })
  },

  //* ***********************完善资质*****************************
  // 终端---变更资质
  QUALIFICATIONS: (data) => {
    return service({
      url: `/api/terminal/change/Qualifications`,
      method: 'put',
      data
    })
  },

  //* ***********************交易中产品*****************************
  TRADINGPRODUCT_LIST: (data) => {
    return service({
      url: `/api/relationStandard/getList-from-terminal`,
      method: 'post',
      data
    })
  },

  TRADINGPRODUCT_DETAIL: (id) => {
    return service({
      url: `/api/relationStandard/getDetail?id=${id}`,
      method: 'get',
    })
  },

  TRADINGPRODUCT_TERMINATION: (id) => {
    return service({
      url: `/api/relationStandard/end/deal?id=${id}`,
      method: 'get',
    })
  },

  // 终端---产品(开发)
  TERMINAL_PRODUCTID: (data) => {
    return service({
      url: '/api/dev/list-for-search-developing-product/product/down/list',
      method: 'post',
      data
    })
  },

  // 终端---产品(交易)
  TERMINAL_PRODUCTIDS: (data) => {
    return service({
      url: '/api/relationStandard/getList-from-terminal/product/down/list',
      method: 'post',
      data
    })
  },

  // 终端---产品(交易)[兼职导报]
  TERMINAL_PRODUCTIDSS: (params) => {
    return service({
      url: '/api/relationStandard/product-list',
      method: 'get',
      params
    })
  },

  // ********************************内控管理--在终端资质列表*********************************
  INTERNAL_CONTROL_TERMINAL_LIST: (data) => {
    return service({
      url: '/api/terminal/internal-control/list',
      method: 'post',
      data
    })
  },
})

